﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;

namespace TripLOA.GUI.PeriodicTripControl
{
    public partial class PeriodicTripTest : TripLOA.GUI.internationalization.LOABasePage
    {
        string[] DbDt1;
        string[] DbDt2;


        public PeriodicTripTest()
        {
            DbDt1 = new string[7];
            DbDt1[0] = "00:00:00";
            DbDt1[1] = "DayNotScheduled";
            DbDt1[2] = "07:15:00";
            DbDt1[3] = "DayNotScheduled";
            DbDt1[4] = "14:30:00";
            DbDt1[5] = "DayNotScheduled";
            DbDt1[6] = "21:45:00";

            DbDt2 = new string[7];
            DbDt2[0] = "DayNotScheduled";
            DbDt2[1] = "03:00:00";
            DbDt2[2] = "DayNotScheduled";
            DbDt2[3] = "10:15:00";
            DbDt2[4] = "DayNotScheduled";
            DbDt2[5] = "17:30:00";
            DbDt2[6] = "DayNotScheduled";
        }


        protected void Page_Load(object sender, EventArgs e)
        {
            /***** solo in visualizzazione viaggio *****/
            ptc.Editable = false;
            /*******************************************/

            /***** per visualizzazione e modifica viaggio *****/
            if (!Page.IsPostBack)
            {
                ptc.DeparturesTime = DbDt1;
                //ptc.DeparturesTime = DbDt2;

                ptc.TripDuration = new TimeSpan(2, 5, 0);
            }
            /**************************************************/
        }

        protected void submit_Click(object sender, EventArgs e)
        {
            /***** per creazione e modifica viaggio *****/
            string[] userDt = ptc.DeparturesTime;

            valido.Text = ptc.IsValid.ToString();
            errore.Text = ptc.ErrorMessage;
            selezionati.Text = ptc.ScheduledDaysNumber.ToString();
            durata.Text = ptc.TripDuration.ToString();
            /********************************************/

            domenica.Text = userDt[0];
            lunedi.Text = userDt[1];
            martedi.Text = userDt[2];
            mercoledi.Text = userDt[3];
            giovedi.Text = userDt[4];
            venerdi.Text = userDt[5];
            sabato.Text = userDt[6];

            ptc.Editable = editabile.Checked;
        }
    }
}
